<?php
include_once('libs/class.database.php');
class Cetakstruk
{
	public $link;
	function __construct()
	{
		$konek= new Database();
		$this->link=$konek->connect();
	}
	function getPembelian($id_username)
	{
		$query=$this->link->query("SELECT * FROM pembelian WHERE id_pembeli='$id_username' ORDER BY tgl_beli DESC");
		$jml_data=$query->rowCount();
		if($jml_data>=1)
		{
			$hasil=$query->fetchAll();
			return $hasil;
		}
		else
		{
			return $jml_data;
		}
	}
		function getMasterDetail($id_beli)
	{
		$query=$this->link->query("SELECT  tgl_beli, total_bayar, jml_jns_bar  from pembelian WHERE  id_beli='$id_beli'");
		$jml_data=$query->rowCount();
		if($jml_data>=1)
		{
			$hasil=$query->fetchAll();
			return $hasil;
		}
		else
		{
			return $jml_data;
		}
	}
	}
?>